/*
 * 
 ****************************************************************************
 * 版本:  v1.0  2019年3月12日  (wangzhiqin)
 * 版权所有:      青岛能蜂电气成都研发中心
 * 笔记:
 * 	1.v0.1  下午2:05:15  初始化文档
 ****************************************************************************
 *
 *
 */
package com.ems;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;

/**
 * 系统启动类</br>
 */
@SpringBootApplication
public class Application extends SpringBootServletInitializer {

	/**
	 * 主程序入口 main
	 * 
	 * @param args 启动参数
	 */
	public static void main(String[] args) {
		SpringApplication.run(Application.class, args);
	}

	/**
	 * 打包部署，启动类注册
	 */
	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
		return application.sources(Application.class);
	}

	/**
	 * 解决请求中特殊字符无响应问题
	 */
	@Bean
	public ConfigurableServletWebServerFactory webServerFactory() {
		TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
		factory.addConnectorCustomizers(connector -> connector.setProperty("relaxedQueryChars", "|{}[]\\"));
		return factory;
	}
}
